﻿using ConsoleAppEFCoreTest1.Model;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleAppEFCoreTest1.Config
{
    //这个类可以不建
    class BookConfig : IEntityTypeConfiguration<Book>
    {
        public void Configure(EntityTypeBuilder<Book> builder)
        {
            builder.ToTable("T_Books");
            builder.Property(b => b.Author).HasMaxLength(32).IsRequired();
            builder.Property(b => b.Author).HasMaxLength(64);
        }
    }
}
